/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package alarmlistener;

import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author rbs
 */
class DataAnalyser {

    private ArrayList<String> rics = new ArrayList<String>();
    private ArrayList<String> texts = new ArrayList<String>();
    private ArrayList<String> funcs = new ArrayList<String>();
    private SchleifenManager mgr;
    private Logger log;

    public DataAnalyser(ArrayList<String> rics_in, ArrayList<String> texts_in, ArrayList<String> funcs_in, SchleifenManager ricmgr) {
        rics = rics_in;
        texts = texts_in;
        funcs = funcs_in;
        mgr = ricmgr;
        log = Logger.getLogger(this.getClass().getName());
    }

    public String getFWDispStartString() throws IOException
    {
        log.log(Level.FINE, "Creating String for Starting FWDisp...");
        String bin = mgr.getBinaryString(rics);

        System.out.println("funcs = " + funcs.size());
        if (funcs.get(0).equals("1"))
            bin += "A";
        else if(funcs.get(0).equals("2"))
            bin += "B";
        else
            bin += "X";
        log.log(Level.FINER, "String for starting FWDisp: {0}", bin);
        return bin;
    }

    public String getExpressText()
    {
        for (String text : texts)
            if (text.length() > 10) //TODO: Add Setting for this
                return text;
        
        return "";
    }
}
